/*
 * areaChart.fx
 *
 * Created on 23-dic-2009, 16:02:42
 */

package ProgramSamples.Graphics;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.chart.*;
import javafx.scene.chart.part.*;



def areaSeries1: AreaChart.Series = AreaChart.Series {
    name: "Series 1"
    data: [
        AreaChart.Data { xValue: 0 yValue: -34 },
        AreaChart.Data { xValue: 3 yValue: -27 },
        AreaChart.Data { xValue: 6 yValue: 42 },
        AreaChart.Data { xValue: 9 yValue: 50 },
        AreaChart.Data { xValue: 12 yValue: 64 },
        AreaChart.Data { xValue: 15 yValue: 56 },
        AreaChart.Data { xValue: 18 yValue: 48 },
        AreaChart.Data { xValue: 21 yValue: 34 },
        AreaChart.Data { xValue: 24 yValue: 30}
    ]
};
def areaSeries2: AreaChart.Series = AreaChart.Series {
    name: "Series 2"
    data: [
        AreaChart.Data { xValue: 0 yValue: 24 },
        AreaChart.Data { xValue: 3 yValue: 17 },
        AreaChart.Data { xValue: 6 yValue: 31 },
        AreaChart.Data { xValue: 9 yValue: 28 },
        AreaChart.Data { xValue: 12 yValue: 45 },
        AreaChart.Data { xValue: 15 yValue: 18 },
        AreaChart.Data { xValue: 18 yValue: 25 },
        AreaChart.Data { xValue: 21 yValue: 28 },
        AreaChart.Data { xValue: 24 yValue: 10 }
    ]
}

def areaSeries3: AreaChart.Series = AreaChart.Series {
    name: "Series 3"
    data: [
        AreaChart.Data { xValue: 0 yValue: 18 },
        AreaChart.Data { xValue: 3 yValue: 25 },
        AreaChart.Data { xValue: 6 yValue: 14 },
        AreaChart.Data { xValue: 9 yValue: -18 },
        AreaChart.Data { xValue: 12 yValue: -22 },
        AreaChart.Data { xValue: 15 yValue: -16 },
        AreaChart.Data { xValue: 18 yValue: -14 },
        AreaChart.Data { xValue: 21 yValue: 12 },
        AreaChart.Data { xValue: 24 yValue: 8 }
    ]
}


def areaChart = AreaChart {
    title: "Temperature Monitoring (in degree C)"
    data: [areaSeries1, areaSeries2, areaSeries3]
    xAxis: NumberAxis {
        label: "Time"
        lowerBound: 0
        upperBound: 24
        minorTickVisible: false
        tickUnit: 1
        formatTickLabel: function(value):String { "{(value as Float) as Integer}" }
    }
    yAxis: NumberAxis {
        label: "Temperature"
        lowerBound: -25
        upperBound: 100
        tickUnit: 25
    }
}



Stage {
    title: "Area Chart"
    scene: Scene{
	    width: 540
            height: 410
            content: areaChart
     } //Scene
}//Stage